#!/bin/bash

# Test snapshot functionality

. ./common

for i in `seq 0 5`; do
    _start_sheep $i
done

_wait_for_sheep 6

_cluster_format -c 1

_vdi_create test 4G
for i in `seq 1 9`; do
    $QEMU_IO -c "write 0 512 -P $i" sheepdog:test | _filter_qemu_io
    $QEMU_IMG snapshot -c tag$i sheepdog:test
done

$QEMU_IO -c "read 0 512 -P 9" sheepdog:test | _filter_qemu_io
for i in `seq 1 9`; do
    $QEMU_IO -c "read 0 512 -P $i" sheepdog:test:tag$i | _filter_qemu_io
done
